var rqTimeout = 1000 * 60; //1 minute
var retryTime = 1000 * 5; //5 seconds

function receive(from_url, update_div) {
    $.ajax({
        url: from_url,
        success: function(data) {
            addmessage(update_div, data+"fgfgf");
            receive(from_url, update_div);
        },
        cache: false,
        timeout: rqTimeout,
        error: function() {
            addmessage(update_div, 'error');
            setTimeout("receive('"+from_url+"','"+update_div+"')", retryTime);
        }
    });
}

function addmessage(update_div, msg){
    $(update_div).append("<br/>" + msg);
}